#!/usr/bin/python
# -*- coding: utf-8 -*-

import os
import sys
#from SeqID import SeqID
from logging import config
import logging
from TimeStamp import getNowDate
from ConfigService import ConfigService
from Utils.ConfigService import cur_file_dir
#from SensorService import SensorService
#from apscheduler.scheduler import Scheduler
#from TopoService import TopoDbService
#from ListMutex import ListMutex

ADB_MACH_CONF_RS_NAME = "MachConfig"
ADB_MACH_POWER_RS_NAME = "MachPower"
ADB_TIME_FORMAT = '%Y-%m-%d %H:%M:%S'
TPLUS_ABNORMAL_DATETIME = "00-00-00 00:00:00"
TPLUS_MAX_MACH_NUM = 16
TPLUS_MACH_POWER_STATE_NONE = 0
TPLUS_MACH_POWER_STATE_ON = 1
TPLUS_MACH_POWER_STATE_OFF = 2
TPLUS_MACH_POWER_STATE_LOST = 3
TPLUS_MACH_POWER_STATE_LOST_TIMEOUT = 120
TPLUS_MACH_POWER_SAMPLE_INTERVAL = 60
TPLUS_MACH_RTD_SAMPLE_INTERVAL = 6
TPLUS_POLLING_DEFAULT_INTERVAL = 0.1
TPLUS_TASK_DEFAULT_INTERVAL = 6

def getLog():
    curPath = cur_file_dir()
    print(" name:%s"%(__name__))
#    if __name__ == 'Utils.SysConstants':
#        curPath += "/../"
    if not os.path.exists(curPath+'/logs') :
        print curPath+'/logs'
        os.makedirs(curPath+'/logs')
    filename = os.path.abspath(curPath+"/conf/logging.config")
##    filename = os.getcwd()+'/'+filename
    config.fileConfig(filename)
    logger = logging.getLogger("root")
    return logger

LOGGER = getLog()

PORTVALUE = 0
IPVALUE = None
MACVALUE = None
#URLVALUE = 'DigiBoard'
PWDVALUE = None
TYPEVALUE = 0
STAR_TIMESTAMP = getNowDate()
G_LIST=[]

##业务接口句柄
SERVERAPI_CONFIGSERVICE = ConfigService()
#SERVERAPI_SENSORSERVICE = SensorService()
#SERVERAPI_TOPOSERVICE = TopoDbService()
#SERVERAPI_GLOABLIST=ListMutex()
#
##生成SequenceID的句柄
#SEQID = SeqID(0, 10000)
#
#
##保持当前所有传感器型号和名称
#SENSORS = SERVERAPI_SENSORSERVICE.getSensorsMap()
#
##系统定时任务
#SCHEDULER = Scheduler()
RUNNING_SCHEDULERS = {}
FIRSTNODEDIC={}
ISSIM = False
